package zb.WX.action.fileUpload;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zb.WX.util.AccessTokenSaveUtil;
import zb.WX.util.GlobalVar;
import zb.WX.util.HttpsUtil;

import java.io.*;

/**
 * 文件上传
 */
@RestController
@RequestMapping("wxFileUpload")
public class FileUpload {

    @RequestMapping("imgUpload")
    public boolean imgUpload(String serverId) throws IOException {
        System.out.println(serverId);
        String url = GlobalVar.TEMPORARY_MATERIAL
                .replace("ACCESS_TOKEN", AccessTokenSaveUtil.getLocationAccesstonken())
                .replace("MEDIA_ID", serverId);
        return HttpsUtil.getMaterial(url);
    }
}
